package cn.chainfind.common.exception;

import cn.chainfind.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @description: 自定义异常处理
 * @author: DT
 * @date: 2021/4/19 21:17
 * @version: v1.0
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value =Exception.class)
    @ResponseBody
    public AjaxResult exceptionHandler(Exception e){
        System.out.println("全局异常捕获>>>:"+e);
        return AjaxResult.error(500,e.getMessage());
    }
}
